package cn.tedu.spring.di;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author lhd
 * @date 2024/4/16
 * 依赖注入演示
 * @apiNote
 */
@Component
public class UserDao {
    //@Value注解 ：基本类型的依赖注入
    @Value("root")
    private String name;
    @Value("123456")
    private String password;
    @Value("jdbc:mysql://localhost:3306/tedu")
    private String url;

    public void run(){
        System.out.println("开始学习spring啦");
    }
    @Override
    public String toString() {
        return "UserDao{" +
                "name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", url='" + url + '\'' +
                '}';
    }
}
